//
// Created by Yun on 2025/2/12.
//

#include "bsp_sys.h"

void Bsp_Sys_Delay(uint32_t u32Time)
{
    HAL_Delay(u32Time);
}

void Bsp_Sys_Init(uint8_t u8Mode)
{
    HAL_Init();
    __HAL_RCC_AFIO_CLK_ENABLE();
    __HAL_RCC_PWR_CLK_ENABLE();
    __HAL_AFIO_REMAP_SWJ_NOJTAG();

    if(u8Mode == Bsp_Sys_Debug_SWD)
        __HAL_RCC_GPIOA_CLK_ENABLE();
//    else if(u8Mode == Bsp_Sys_Debug_JTAG)
//        ;
}

void Error_Handler(void)
{
    /* USER CODE BEGIN Error_Handler_Debug */
    /* User can add his own implementation to report the HAL error return state */
    __disable_irq();
    while (1)
    {
    }
    /* USER CODE END Error_Handler_Debug */
}

#ifdef  USE_FULL_ASSERT
/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t *file, uint32_t line)
{
  /* USER CODE BEGIN 6 */
        /* User can add his own implementation to report the file name and line number,
                 ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  /* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */

Sys_Interface_TypeDef stBspSysInterface = {
    .Delay = Bsp_Sys_Delay,
    .Init = Bsp_Sys_Init
};



